﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entity;
using System.Data.Linq.SqlClient;
using System.Data.Linq;
using System.Collections;
using System.Data.Objects;

namespace DAO
{
    /// <summary>
    /// ket noi voi csdl cua sale
    /// </summary>
    public class SaleDAO
    {
        BMS_DatabaseEntities context = new BMS_DatabaseEntities();
        /// <summary>
        /// Lay tat ca danh sach sale
        /// </summary>
        public List<SaleInfoEntity> LoadSale()
        {
            var query = from sale in context.STAFF_INFO
                        select new SaleInfoEntity
                        {    
                            SaleName=sale.FULL_NAME_VN,                    
                        };
            return query.ToList<SaleInfoEntity>();
        }

        /// <summary>
        /// Lay tat ca danh sach sale tru sale name
        /// </summary>
        public List<SaleInfoEntity> LoadSale(string SaleName)
        {
            var query = from sale in context.STAFF_INFO where sale.FULL_NAME_VN!=SaleName
                        select new SaleInfoEntity
                        {                          
                            SaleName = sale.FULL_NAME_VN,    
                        };
            return query.ToList<SaleInfoEntity>();
        }
    }
}
